{extend name="admin@index_layout"/}
{block name="main"}
<form class="layui-form" method="post">
    <div class="layui-tab">
        <ul class="layui-tab-title">
            <li class="layui-this">基本设置</li>
            <li id="modeTab">模板设置</li>
            {volist name="site" id="s" key="i" }
            {if (isset(cache("Cms_Config")['category_mode']) && 2 == cache("Cms_Config")['category_mode'])}
            {if $i == getSiteInfo('id')}
            {include file="item_site" /}
            {/if}
            {else}
            {include file="item_site" /}
            {/if}
            {/volist}
        </ul>
        <div class="layui-tab-content">
            <div class="layui-tab-item layui-show">
                <div class="layui-form-item">
                    <label>所属站点</label>
                    <div class="layui-form-field-label">
                        {volist name="site" id="vo"}
                        <input type="checkbox" name="site_id[]" value="{$vo.id}" lay-skin="primary" title="{$vo.name}" {if $data && in_array($vo.id,$data.site_id)}checked{/if}>
                        {/volist}
                    </div>
                    <div class="layui-form-mid layui-word-aux">不选，表示所有站点共用</div>
                </div>
                <div class="layui-form-item">
                    <label>上级菜单</label>
                    <div class="w300">
                        <select name="parentid" lay-verify="required">
                            <option value="0">作为顶级栏目</option>
                            {$category|raw}
                        </select>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label>栏目标题 </label>
                    <div class="w300">
                        <input type="text" name="catname" lay-verify="required" autocomplete="off" placeholder="栏目名称" class="layui-input" value="{$data.catname}">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label>唯一标识</label>
                    <div class="w300">
                        <input type="text" name="catdir"  autocomplete="off" placeholder="唯一标识" class="layui-input" value="{$data.catdir}">
                    </div>
                    <div class="layui-form-mid layui-word-aux">英文数字组成，留空则自动生成拼音</div>
                </div>
                <div class="layui-form-item web_link">
                    <label>链接地址</label>
                    <div>
                        <div class="layui-input-inline w300">
                            <input type="text" name="url" autocomplete="off" placeholder="自定义链接地址" class="layui-input" id="url" value="{$data.url}">
                        </div>
                        <div class="layui-input-inline">
                            <select lay-filter="fasttype">
                                <option data-url="">常用内部链接</option>
                                <option data-url="cms/index/index">首页</option>
                                {if isset(cache("Cms_Config")['site_url_mode']) && 1==cache("Cms_Config")['site_url_mode']}
                                <option data-url="cms/index/lists?catid=2">列表页/单页</option>
                                <option data-url="cms/index/shows?catid=2&id=1">详情页</option>
                                {else}
                                <option data-url="cms/index/lists?catdir=Introduction">列表页/单页</option>
                                <option data-url="cms/index/shows?catdir=Introduction&id=1">详情页</option>
                                {/if}
                                {if isModuleInstall('formguide')}
                                <option data-url="formguide/index/index?id=2">表单页</option>
                                {/if}
                            </select>
                        </div>
                    </div>
                    <div style="clear: both;"></div>
                    <div class="layui-form-mid layui-word-aux">有值时生效，内部链接格式:模块/控制器/操作?参数=参数值&...，外部链接则必须http://开头</div>
                </div>

                <div class="layui-form-item layui-form-text">
                    <label>栏目图片</label>
                    <div class="layui-form-field-label border-none">
                        <div class="js-upload-image">
                            {php}echo \util\Form::images('image','',$data['image']){/php}
                        </div>
                    </div>
                </div>
                {if isset(cache("Cms_Config")['icon_mode']) && 1==cache("Cms_Config")['icon_mode']}
                <div class="layui-form-item layui-form-text">
                    <label>栏目图标</label>
                    <div class="layui-form-field-label border-none">
                        <div class="js-upload-image">
                            {php}echo \util\Form::images('icon','',$data['icon']){/php}
                        </div>
                    </div>
                </div>
                {else}
                <div class="layui-form-item">
                    <label>栏目图标</label>
                    <div class="w300">
                        <input type="text" name="icon" autocomplete="off" placeholder="栏目图标格式iconfont-icon或layui-icon-rate" class="layui-input" value="{$data.icon}">
                    </div>
                    <div class="layui-form-mid layui-word-aux">手动输入字体样式：如iconfont-icon或layui-icon-rate</div>
                </div>
                {/if}
                <div class="layui-form-item">
                    <label>在导航显示</label>
                    <div class="w300">
                        <input type="radio" name="status" value="1" title="显示" {eq name="data.status" value="1"}checked{/eq}> <input type="radio" name="status" value="0" title="隐藏" {eq name="data.status" value="0" }checked{/eq}> </div> </div> <div class="layui-form-item">
                <label>显示排序</label>
                <div class="w300">
                    <input type="text" name="listorder" autocomplete="off" placeholder="显示排序" class="layui-input" value="{$data['listorder']}">
                </div>
            </div>
            </div>

            <div class="layui-tab-item">
                <div class="layui-form-item web_page">
                    <label class="w100">单页模板</label>
                    <div class="w300">
                        <select name="setting[page_template]">
                            <option value="page.{:config('template.view_suffix')}" selected>默认内容页:page.{:config('template.view_suffix')}</option>
                            {volist name="tp_page" id="vo"}
                            <option value="{$vo}" {eq name="setting['page_template']" value="$vo"}selected{/eq}>{$vo} </option>
                            {/volist}
                        </select>
                    </div>
                    <div class="layui-form-mid layui-word-aux">新增模板以page_xx.{:config('template.view_suffix')}形式</div>
                </div>
            </div>
            <!-- 多语言设置 -->
            {volist name="category_data" id="s" key="k"}
            <?php
            $setting = json_decode($s['setting'],true);
            $page_title = $setting['title'];
            $page_keyword = $setting['keyword'];
            $page_description = $setting['description'];
            $siteId = $s['site_id'];
            $cdId = $s['id'];
            ?>
            {if (isset(cache("Cms_Config")['category_mode']) && 2 == cache("Cms_Config")['category_mode'])}
            {if $k == getSiteInfo('id')}
            {include file="item_category" /}
            {/if}
            {else}
            {include file="item_category" /}
            {/if}
            {/volist}
            <!-- 多语言设置 end-->

        </div>
        <input type="hidden" name="type" value="1">
        <input name="id" type="hidden" value="{$data.id}">
        <div class="layui-form-item layer-footer">
            <div>
                <button class="layui-btn" lay-submit>立即提交</button>
                <button type="reset" class="layui-btn layui-btn-primary">重置</button>
            </div>
        </div>
    </div>
</form>
{/block}
{block name="script"}
<script type="text/javascript">
    layui.use(['form','yznForm'], function() {
        var form = layui.form,
            yznForm = layui.yznForm;

        yznForm.listen();
        form.on('select(fasttype)', function(data) {
            $('#url').val($(data.elem).find("option:selected").attr("data-url"));
        });
    });
</script>
{/block}
